package virtorina.server.rpc;

import java.util.LinkedList;

import virtorina.client.admin.rpc.AdminService;
import virtorina.client.room.dto.ComplaintDTO;
import virtorina.server.domain.Complaint;
import virtorina.server.domain.Question;
import virtorina.server.domain.User;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

public class AdminServiceImpl extends RemoteServiceServlet implements
		AdminService {

	
	@Override
	public LinkedList<ComplaintDTO> getTopComplaints() {
		return Complaint.getTopDTOComplaints();

	}

	@Override
	public boolean getAccessToComplains() {
		Long UserID = (Long) this.getThreadLocalRequest().getSession()
				.getAttribute("user");
		if (UserID == null){
			return false;
		}
		int rank = User.getRank(UserID);
		System.out.println("test2");
		if (rank >= 2){
			return true;
		}else{
			return false;
		}
	}
}
